//
// 这里用调用三方库的例子来解释如何应用 Template Methmod 模板模式
//

#pragma once

#include <iostream>

class Library{
    // 假设有个算法，获得结果需要步骤1~5

public:

    void run() {
        std::cout << "Library::run" << std::endl;
        Step01();
        Step02();
        Step03();
        Step04();
        Step05();
    }

protected:

    virtual void Step01() {
        std::cout << "Library::Step01" << std::endl;
    }

    virtual void Step02() {
        std::cout << "Library::Step02" << std::endl;
    }

    virtual void Step03() {
        std::cout << "Library::Step03" << std::endl;
    }

    virtual void Step04() {
        std::cout << "Library::Step04" << std::endl;
    }

    virtual void Step05() {
        std::cout << "Library::Step05" << std::endl;
    }
};

class Application : public Library {
    virtual void Step02() override {
        std::cout << "Application::Step02" << std::endl;
    }

    virtual void Step04() override {
        std::cout << "Application::Step04" << std::endl;
    }
};
